if condition : if condition : Statements ---------- ---------- next statements
a=int(input("Enter a Number:")) if a>0: print("Number is Positive") if a%2==0: print(a,"is Even") else: print(a,"is Odd") else: print("Number is Not Positive")
Enter a no.: 28 Number is Positive 28 is Even
a=int(input("Enter a Number:")) if a>0: print("Number is Positive") if a>=10 and a<=99: print("it is a 2 digit Number") else: print("it is NOT a 2 digit Number") else: print("Number is Not Positive")
Enter a no.: 28 Number is Positive It is a 2 digit number
a,b,c=input("Enter 3 Angles :").split() a,b,c=int(a),int(b),int(c) if a+b+c==180: print("Triangle can be formed") if a==b==c: print("Equilateral Triangle") if a==b or b==c or c==a: print("Isosceles Triangle") if a==90 or b==90 or c==90: print("Right angled Triangle") else: print("Triangle cannot be formed..")
Enter 3 Angles: 45 90 45 Triangle can be formed Isosceles Triangle Right angled Triangle
a=int(input("Enter a Number:")) if a>=10 and a<=99: print("It is 2 digit number") f=a//10 l=a%10 if f==l: print("Both digit are same") else: print("Both digit are not same") else: print("It is not 2 digit number")
Enter a no.: 66 It is 2 digit no. Both digit are same